package com.StephenHu.Javabean;

import java.util.Scanner;

public class RoleTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        Role r1 = new Role();
        System.out.println("请输入创建的角色的姓名：");
        r1.setName(sc.nextLine());
        System.out.println("请输入创建的角色的血量：");
        r1.setBlood(sc.nextInt());
        System.out.println("请输入创建的角色的攻击力：");
        r1.setAttack_power(sc.nextInt());
        System.out.println("请输入创建的角色的防御力：");
        r1.setDefence_power(sc.nextInt());

        Role r2 = new Role("乔峰",1000,150,200);


        System.out.println("战斗开始");

        while (true){
            r1.attack(r2);
            if (r2.getBlood() == 0){
                System.out.println(r1.getName()+' '+"KO了"+' '+r2.getName());
                break;
            }

            r2.attack(r1);
            if (r1.getBlood() == 0){
                System.out.println(r2.getName()+' '+"KO了"+' '+r1.getName());
                break;
            }
        }
    }
}
